#ifndef  PROC_H
#define  PROC_H

#include "../util/types.h"
#include "../util/param.h"
#include "context.h"

enum proc_state { UNUSED, RUNNABLE, RUNNING };

// process state
struct proc
{
  char *mem;                //Start of process memory (kernel address)
  uint sz;                  //Size of process memory (bytes)
  char *kstack;             //Bottom of kernel stack for this process
  enum proc_state state;    //Process state
  struct context mc;
  char name[16];            //Process name (debugging)
};

/* Process memory is laid out contiguously, low addresses first: */
/*   text */
/*   original data and bss */
/*   fixed-size stack */
/*   expandable heap */

/* function */
struct proc *allocProc();
/* int                  growproc(int); */
void userInit();
void procExit();
void procScheduler ();


//struct proc*    copyproc(struct proc*);
//int             kill(int);
//void            scheduler(void) __attribute__((noreturn));
//void            pinit(void);
//void            procdump(void);
//void            setupsegs(struct proc*);
//void            sleep(void*, struct spinlock*);
//int             wait(void);
//void            wakeup(void*);
//void            yield(void);

#endif
